﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Revis.VClinicNet.App.Internal.Dto;

namespace Revis.VClinicNet.UI.Internal.Mvc.Models
{
    public class VisitInfoModel
    {
        public long Id { get; set; }
        public string Date { get; set; }
        public string PatientName { get; set; }
    }

    public class JsonWorkInfoModel
    {
        public DoctorInfoDto Doctor { get; set; }
        public WorkTimeRoomInfoDto WorkTime { get; set; }
        public IList<VisitInfoModel> Visits { get; set; }

        public JsonWorkInfoModel(DoctorWorkInfoDto info)
        {
            Doctor = info.Doctor;
            WorkTime = info.WorkTime;
            Visits = info.Visits.Select(v => {
                return new VisitInfoModel() {
                    Id = v.Id,
                    Date = v.Date.ToShortTimeString(),
                    PatientName = v.PatientName
                };
            }).ToList();
        }

        public JsonWorkInfoModel()
        {
            Doctor = new DoctorInfoDto();
            WorkTime = new WorkTimeRoomInfoDto() { BeginInfo = "00:00", EndInfo = "00-00" };
            Visits = new List<VisitInfoModel>();
        }

    }
}